
using System;
using System.Collections.Generic;
using System.Data;
namespace Reverso.DataObjects
{


	public class Tabela
	{

		public Tabela ()
		{
		}
		
		public List<ValueObjects.Tabela> Buscar()
		{
			DBHelper dbh = new DBHelper();
			DataSet oDs;
			List<ValueObjects.Tabela> Tabelas = new List<ValueObjects.Tabela>();
			string SQL = "SELECT Object_Name,Object_Id FROM ALL_OBJECTS"+
						 " WHERE Owner = 'HR'"+
						 " AND Object_Name"+ 
						 " NOT IN (SELECT object_name FROM RECYCLEBIN)"+
						 " AND Object_Type='TABLE'";
			
			oDs = dbh.ExecutarConsulta(SQL);
			
			foreach(DataRow dr in oDs.Tables[0].Rows)
			{
				ValueObjects.Tabela t = new ValueObjects.Tabela();
				t.Nome = dr["Object_Name"].ToString();
				t.Id = Convert.ToInt16(dr["Object_Id"].ToString());
				Tabelas.Add(t);
			}
			return Tabelas;
			
		}
	}
}
